Skip to content

Check every published export subpath loads in Node - #131

Merged
woksin merged 1 commit into
mainfrom
build/118-verify-published-exports
Aug 13, 2026
Merged

Check every published export subpath loads in Node#131
woksin merged 1 commit into
mainfrom
build/118-verify-published-exports

Conversation

@woksin

@woksin woksin commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Added

The published shape was never built in CI - build is tsc only, while the
real artifact comes from prepare via rollup - so nothing ever imported
what consumers import. That is why #118 reached a release.

This spawns a child node per exports subpath and loads the real package
specifier, so resolution goes through the exports map exactly as a
consumer's does, and reports the actual error per subpath rather than a
total. Non-JS entries are existence-checked; importing them would only
ever yield ERR_UNKNOWN_FILE_EXTENSION and say nothing about #118.

Wired in as a non-blocking job on purpose: it is red today, because it
reproduces #118. It becomes blocking once the directory imports and the
CSS side-effect imports are both resolved.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@woksin woksin added the patch label Aug 13, 2026
Comment on lines +72 to +106
runs-on: ubuntu-latest
continue-on-error: true

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 23.x
registry-url: "https://registry.npmjs.org"

- uses: actions/cache@v4
id: yarn-cache
with:
path: |
.yarn/cache
**/node_modules
**/.eslintcache
**/yarn.lock
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}

- name: Yarn install
run: yarn

- name: Build the published artifact
working-directory: Source
run: |
export NODE_OPTIONS="--max-old-space-size=4096"
yarn run prepare

- name: Verify published exports
working-directory: Source
run: node scripts/verify-exports.mjs
@woksin

woksin commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Reviewer context, kept out of the body.

Scope. This does not attempt the #118 defect itself — that is structurally coupled to PrimeReact 11 (#107), because primereact@10.9.8 ships no exports field and its own dialog.esm.js imports bare primereact/api, so rewriting our specifiers only moves the failure one level in. No component source and no dependency manifest was touched.

What it measures, and the result — see the full table on #118. Headline: 29 checks failed across 21 subpaths; only ./types loads under ESM; and the CJS column shows 12 subpaths still failing on CSS alone, which is the post-#107 world. That is hard evidence the CSS half is independent of PrimeReact 11.

Design. One child node per subpath so a failure cannot poison the next, each loading the real @cratis/components/<subpath> specifier through the workspace symlink into Source/dist/esm or dist/cjs — the resolution a consumer gets, not the source tree. It fails fast with a "run prepare first" message if dist/esm is absent. Non-JS entries (./styles, ./tokens, ./package.json) are existence-checked rather than imported; importing them would always yield ERR_UNKNOWN_FILE_EXTENSION and say nothing about #118.

Non-blocking on purpose, at job level rather than step level, so nothing in the new job — including a broken publish build — can gate a merge while the underlying defect is open. A comment in the workflow says when it should become blocking. Deliberately not added to prepare, which would break publishing immediately, and no npm script was added — Source/package.json is byte-identical.

Semver patch: files publishes only dist, so the script never ships and nothing in the published package changes.

Not verified: the job has not run on a real runner — validated locally and as YAML only. Components tracks no lockfile, so CI may resolve different transitive versions and produce a different failure set. The workflow's paths: filter matches Source/**, so the script triggers it but a workflow-only edit would not; left alone as out of scope. Resolution goes through the workspace symlink rather than an installed tarball — the exports map and dist layout are identical, but I did not npm pack into a scratch project to confirm.

@woksin
woksin merged commit f84e14e into main Aug 13, 2026
5 of 6 checks passed
@woksin
woksin deleted the build/118-verify-published-exports branch August 13, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants